package com.lkd.feign.fallback;

import com.lkd.feign.UserServiceFeignClient;
import com.lkd.vo.PartnerVO;
import com.lkd.vo.UserVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserServiceFeignClient> {
    @Override
    public UserServiceFeignClient create(Throwable throwable) {

        log.error("调用user服务失败，{}",throwable);
        return new UserServiceFeignClient() {
            @Override
            public UserVO findById(Integer id) {
                return null;
            }

            @Override
            public Integer getOperatorCount() {
                return 0;
            }

            @Override
            public Integer getRepairerCount() {
                return 0;
            }

            @Override
            public PartnerVO getPartner(Integer id) {
                return null;
            }
        };
    }
}
